<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 封装函数表达式的函数不管用户输入什么数字，求出,数组返回最大值，最小值，平均值，解构出来打印在页面中

      let arr = [324, 54645, 213423, 345435, 454, 454364]
      let array = []
      function Mynum() {
        // console.log(Math.max(...arr))
        const max = Math.max(...arr)
        const min = Math.min(...arr)
        console.log(max, min)

        let avg = 0
        for (let i = 0; i < arr.length; i++) {
          avg = (avg + arr[i]) / arr.length
        }
        console.log(avg)
        array.push(max, min, avg)
        console.log(array)
      }
      Mynum()
    </script>
  </body>
</html>
